package com.example.demo.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.example.demo.entity.Role;
import com.example.demo.mapper.RoleMapper;
import com.example.demo.service.RoleService;

@Service
@Transactional
public class RoleServiceImpl implements  RoleService{

	@Autowired
	private RoleMapper roleMapper;
	
	private List<Role> list;
	
	private Role role1;
	
	@Override
	public int updateRole(Role role){
		
		return roleMapper.updateRole(role);
	}
	@Override
	public List<Role> selectRole(){
		list=new ArrayList<Role>();
		list=roleMapper.selectRole();
		return list;
	}
	@Override
	public Role selectOneRole(Integer rid){
		role1= new Role();
		role1= roleMapper.selectOneRole(rid); 
		return role1;
	}

	@Override
	public int addRole(Role role) {
		// TODO Auto-generated method stub
		return roleMapper.insertRole(role);
	}

	@Override
	public int delRole(Integer rid) {
		// TODO Auto-generated method stub
		return roleMapper.deleteRole(rid);
	}

	
}
